﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _01.简单数组
{
    class Program
    {
        static void Main(string[] args)
        {
            //声明一个数组
            
            int[] arr_int=new int[5];//必须给定值
            int[] arr_int2 = new int[5] { 1, 2, 3, 4, 5 };
            int[] arr_int3 = { 1, 2, 3, 4, 5, 6 };
            int int_1 = arr_int[0];//0开始
            Console.WriteLine("-------------foreach循环输出---------------");
            foreach (int item in arr_int2)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("-------------for循环输出---------------");
            for (int i = 0; i < arr_int2.Length; i++)
            {
                Console.WriteLine(arr_int2[i]);
            }
            Console.WriteLine("-------------Person---------------");
            Person[] arr_person = new Person[5]
            {
                new Person(1,"001"),
                new Person(2,"002"),
                new Person(3,"003"),
                new Person(4,"004"),
                new Person(5,"005")
            };
            foreach (Person p in arr_person)
            {
                Console.WriteLine("此人的Id：{0},Name：{1}",p.Id,p.Name);
            }
            Console.WriteLine("-------------int[1,1]---------------");
            int[, , , , ,] arr_int22 = new int[1, 2, 3, 4, 5, 1];
            int[,] arr_int4=new int[5,1];
            arr_int4[0, 0] = 123;
            arr_int4[1, 0] = 124;
            arr_int4[2, 0] = 125;
            arr_int4[3, 0] = 126;
           // arr_int4[4, 0] = 127;
            Console.WriteLine("-------------foreach---------------");
            foreach (int i in arr_int4)
            {
                Console.WriteLine(i);
            }
            
           
            Console.ReadKey();
        }
    }
}
